
"""
本文件将页面元素和selenium封装的基类相结合，创建了页面对象

"""
from page.webpage import WebPage, sleep
from common.readelement import Element
from utils.logger import log
search = Element('search')

class SearchPage(WebPage):

    def open_dl(self):
        """点击首页的登录跳转到登录页"""
        self.is_click(search['打开登录页'][0],search['打开登录页'][1])

    def click_mobile(self):
        """点击手机号文本框"""
        self.is_click(search['手机号'][0],search['手机号'][1])

    def input_mobile(self, content):
        """输入手机号"""
        self.input_text(search['手机号'][0],search['手机号'][1],txt=content)
        sleep()

    def sx_yzm(self):
        """刷新图形验证码"""
        self.is_click(search['刷新验证码'][0],search['刷新验证码'][1])

    def click_yzm(self):
        """点击图形验证码文本框"""
        self.is_click(search['图形验证码'][0],search['图形验证码'][1])

    def input_yzm(self, content):
        """输入图形验证码"""
        self.input_text(search['图形验证码'][0],search['图形验证码'][1],txt=content)
        sleep()

    def click_mm(self):
        """点击密码文本框"""
        self.is_click(search['密码'][0],search['密码'][1])

    def input_mm(self, content):
        """输入密码"""
        self.input_text(search['密码'][0],search['密码'][1],txt=content)
        sleep()

    def click_login(self):
        """点击登录按钮"""
        self.is_click(search['登录'][0],search['登录'][1])

    def click_tx(self):
        """登录后点击右上角头像"""
        self.is_click(search['头像'][0], search['头像'][1])

    def click_grzx(self):
        """登录后点击个人中心按钮"""
        self.is_click(search['个人'][0],search['个人'][1])

    def get_gr_text(self):
        """登录后查找个人中心按钮"""
        _t = self.element_text(search['个人'][0],search['个人'][1])
        return _t

    def click_zz(self):
        """点击左侧数字作品铸造菜单"""
        self.is_click(search['铸造'][0],search['铸造'][1])

    def click_djzz(self):
        """点击右上角数字作品铸造"""
        self.is_click(search['点击铸造'][0],search['点击铸造'][1])

    def click_zpj(self):
        """创建作品集"""
        self.is_click(search['选择作品集'][0],search['选择作品集'][1])

    def enter_zp(self):
        """"""
        self.click_enter(search['选择首个作品集'][0], search['选择首个作品集'][1])
        sleep()

    def enter_lx(self):
        """"""
        self.click_enter(search['作品原件类型'][0], search['作品原件类型'][1])
        sleep()


    def sc_f(self,content):
        """"""
        self.sc_fg(search['上传封面'][0], search['上传封面'][1],txt=content)
        sleep()

    def sc_yj(self,content):
        """"""
        self.sc_fg(search['上传作品原件'][0], search['上传作品原件'][1],txt=content)
        sleep()

    def click_zpmc(self):
        """点击作品名称"""
        self.is_click(search['作品名称'][0],search['作品名称'][1])

    def input_zpmc(self, content):
        """输入作品名称"""
        self.input_text(search['作品名称'][0],search['作品名称'][1],txt=content)
        sleep()

    def click_zpms(self):
        """点击作品描述"""
        self.is_click(search['作品描述'][0],search['作品描述'][1])

    def input_zpms(self, content):
        """输入作品描述"""
        self.input_text(search['作品描述'][0],search['作品描述'][1],txt=content)
        sleep()

    def click_jg(self):
        """点击价格"""
        self.is_click(search['价格'][0],search['价格'][1])

    def input_jg(self, content):
        """输入价格"""
        self.input_text(search['价格'][0],search['价格'][1],txt=content)
        sleep()

    def click_bq(self):
        """点击作品版权使用费"""
        self.is_click(search['作品版权使用费'][0],search['作品版权使用费'][1])

    def input_bq(self, content):
        """输入作品版权使用费"""
        self.input_text(search['作品版权使用费'][0],search['作品版权使用费'][1],txt=content)
        sleep()

    def click_fl(self):
        """点击作品分类"""
        self.is_click(search['作品分类'][0],search['作品分类'][1])

    def enter_fl(self):
        """首个作品分类"""
        self.click_enter(search['作品分类'][0], search['作品分类'][1])
        sleep()

    def click_bq(self):
        """点击作品标签"""
        self.is_click(search['作品标签1'][0],search['作品标签1'][1])

    def input_biaoq(self, content):
        """输入作品标签"""
        self.input_text(search['作品标签2'][0],search['作品标签2'][1],txt=content)
        sleep()

    def enter_biaoq(self):
        """首个作品分类"""
        self.click_enter(search['作品标签2'][0], search['作品标签2'][1])
        sleep()

    def click_sw(self):
        """勾选捆绑实物售卖"""
        self.is_click(search['捆绑实物售卖'][0],search['捆绑实物售卖'][1])

    def click_jz(self):
        """勾选禁止转售"""
        self.is_click(search['禁止转售'][0],search['禁止转售'][1])

    def click_zt(self):
        """勾选显示原件使用状态"""
        self.is_click(search['显示原件'][0],search['显示原件'][1])

    def click_sqzz(self):
        """点击申请铸造按钮"""
        self.is_click(search['申请铸造'][0],search['申请铸造'][1])

    def click_jymm(self):
        """点击交易密码"""
        self.is_click(search['交易密码'][0],search['交易密码'][1])

    def input_jymm(self, content):
        """输入交易密码"""
        self.input_text(search['交易密码'][0],search['交易密码'][1],txt=content)
        sleep()

    def click_tjzz(self):
        """提交铸造"""
        self.is_click(search['提交铸造'][0],search['提交铸造'][1])

    def click_gsd(self):
        """点击左侧我的挂售单菜单"""
        self.is_click(search['我的挂售单'][0],search['我的挂售单'][1])

    def click_djgs(self):
        """点击挂售数字作品"""
        self.is_click(search['挂售数字作品'][0],search['挂售数字作品'][1])

    def click_gsmc(self):
        """点击作品名称"""
        self.is_click(search['作品名称'][0],search['作品名称'][1])

    def enter_gsmc(self):
        """选取作品名称"""
        self.click_enter(search['作品名称'][0], search['作品名称'][1])
        sleep()

    def click_gsjg(self):
        """点击挂售价格"""
        self.is_click(search['挂售价格'][0],search['挂售价格'][1])

    def send_qkjg(self):
        """清空挂售价格"""
        self.send_BackSpace(search['挂售价格'][0],search['挂售价格'][1])

    def input_gsjg(self, content):
        """输入挂售价格"""
        self.input_text(search['挂售价格'][0],search['挂售价格'][1],txt=content)
        sleep()

    def click_gsjymm(self):
        """点击交易密码"""
        self.is_click(search['交易密码'][0],search['交易密码'][1])

    def input_gsjymm(self, content):
        """输入交易密码"""
        self.input_text(search['交易密码'][0],search['交易密码'][1],txt=content)
        sleep()

    def click_gsqr(self):
        """点击挂售确认"""
        self.is_click(search['挂售确认'][0],search['挂售确认'][1])

    def click_xj(self):
        """点击下架"""
        self.is_click(search['下架'][0],search['下架'][1])

    def click_xjqr(self):
        """点击下架确认"""
        self.is_click(search['下架确认'][0],search['下架确认'][1])